local opt = vim.opt

-- auto-reloading a file in vim as soon as it changes on disk
opt.autoread = true

-- zh搜索时
opt.inccommand = "nosplit" -- or split

-- fold
opt.foldmethod= 'expr'
opt.foldexpr = "nvim_treesitter#foldexpr()"
opt.foldlevel = 99

-- line numbers
opt.relativenumber = true -- show relative line numbers
--opt.number = false

-- tabs & indentation (适合python)
-- https://stackoverflow.com/questions/65076/how-do-i-set-up-vim-autoindentation-properly-for-editing-python-files
opt.expandtab = true -- expand tab to spaces
opt.tabstop = 4
opt.softtabstop =4
opt.shiftwidth = 4
opt.autoindent = true
opt.smartindent = true
opt.smarttab = true

-- line wrapping
opt.wrap = false -- disable line wrapping(use autocmd to turn on by filetype, etc. md)

-- search settings
opt.ignorecase = true -- ignore case when searching
opt.smartcase = true -- if you include mixed case in your search, assumes you want case-sensitive

-- cursor line
opt.cursorline = true -- highlight the current cursor line

-- appearance
opt.termguicolors = true -- turn on termguicolors for nightfly colorscheme to work
opt.background = "dark" -- colorschemes that can be light or dark will be made dark
opt.signcolumn = "auto:1" -- show sign column so that text doesn't shift
opt.guicursor='n-v-c:block-Cursor/lCursor,i-ci-ve:ver100-iCursor'

-- backspace
opt.backspace = "indent,eol,start" -- allow backspace on indent, end of line or insert mode start position

-- clipboard
opt.clipboard:append("unnamedplus") -- use system clipboard as default register

-- split windows
opt.splitright = true -- split vertical window to the right
opt.splitbelow = true -- split horizontal window to the bottom

-- temp file
opt.swapfile = false
opt.backup = false

opt.undodir = vim.fn.stdpath("config") .. "/../undodir"
opt.undofile = true

-- mouse off
opt.mouse = ''

-- Memory, CPU
opt.hidden = true           -- Enable background buffers
opt.history = 100           -- Remember N lines in history
opt.lazyredraw = true       -- Faster scrolling
opt.synmaxcol = 240         -- Max column for syntax highlight
opt.updatetime = 250        -- ms to wait for trigger an event
opt.pumheight = 10          -- completion height

-- Disable nvim intro
opt.shortmess:append "sI"

-- 不显示状态行
vim.cmd([[
    set laststatus=0
    hi! link StatusLine Normal
    hi! link StatusLineNC Normal
    set statusline=%{repeat('─',winwidth('.'))}
]])

-- 不显示 ~ (dash) for end of the buffer
vim.cmd([[
    set fillchars=fold:\ ,vert:\│,eob:\ ,msgsep:‾
]])

-- spell
--opt.spelllang = 'en_us'
--opt.spell = true
--opt.spellfile = vim.fn.stdpath("config") .. "/../spell-en.add"

-- misc
opt.showmode = false -- get rid of the default mode indicator
-- opt.cmdheight = 0
opt.ruler = false
opt.jumpoptions = "stack"

opt.cursorcolumn = true -- 如何改变其背景色?
-- highlight CursorColumn guibg=#333355

opt.shell = "fish"

-- v0.11 need
vim.diagnostic.config({
  virtual_text = true,
})

-- EOF
